<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                }
            }
        </script>
        <style type="text/css">
            .col-95 {
                width: 95%;
            }

            .col-5 {
                width: 5%;
            }
        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px">
            <p:tabView id="tabview" dynamic="true" cache="false" style="font-weight:normal;font-style:normal">
                <p:tab title="海尔卡消费">
                    <h:form>
                        <div id="qrytable">
                            <p:messages id="msgs" showDetail="false"/>
                            <p:focus for="cardno"/>
                            <p:panel style="margin-top:10px" id="panel">
                                <h:panelGrid columns="2" cellspacing="5" columnClasses="col-95,col-5">
                                    <h:panelGrid columns="4" cellspacing="5" style="text-align: left;">
                                        <h:outputLabel value="*卡号:"/>
                                        <p:inputText id="cardno" value="#{cdttxnAction.cardNo}" required="true"
                                                     requiredMessage="必须输入卡号！" size="30"/>
                                        <h:outputLabel value="*产品信息:"/>
                                        <p:inputText id="pdctinfo" value="#{cdttxnAction.newCdttxn.pdctinfo}"
                                                     required="true"
                                                     requiredMessage="必须输入产品信息！" size="50"/>
                                        <h:outputLabel value="*客户姓名:"/>
                                        <p:inputText id="cnsumname" value="#{cdttxnAction.newCdttxn.cnsumname}"
                                                     required="true"
                                                     requiredMessage="必须输入客户姓名！" size="30"/>

                                        <h:outputLabel value="*身份证号:"/>
                                        <p:inputText id="idcode" value="#{cdttxnAction.newCdttxn.idcode}"
                                                     required="true"
                                                     requiredMessage="必须输入身份证号！" size="30"/>
                                        <h:outputLabel value="*客户电话:"/>
                                        <p:inputText id="cnsumtel" value="#{cdttxnAction.newCdttxn.cnsumtel}"
                                                     required="true"
                                                     requiredMessage="必须输入客户电话！" size="30"/>
                                        <h:outputLabel value="*金额:"/>
                                        <p:inputText value="#{cdttxnAction.txnAmt}" required="true"
                                                     requiredMessage="必须输入消费金额！" size="30"/>

                                        <h:outputLabel value="*密码:"/>
                                        <p:password value="#{cdttxnAction.pin}" required="true"
                                                    requiredMessage="必须输入密码！" size="30"/>
                                    </h:panelGrid>
                                    <h:panelGrid>
                                        <p:commandButton style="width:90px;" value="确认消费"
                                                         update="pdt,msgs,panel"
                                                         action="#{cdttxnAction.onConsume}"
                                                >
                                        </p:commandButton>
                                    </h:panelGrid>
                                </h:panelGrid>
                            </p:panel>
                            <p:ajaxStatus style="height:18px;text-align:center">
                                <f:facet name="start">
                                    <h:graphicImage value="/images/ajaxloadingbar.gif"/>
                                </f:facet>
                                <f:facet name="complete">
                                    <h:outputText value=""/>
                                </f:facet>
                            </p:ajaxStatus>
                            <p:dataTable id="pdt" dynamic="true" style="width:100%;"
                                         value="#{cdttxnAction.txnList}" var="record"
                                         rowKey="#{record.pkid}"
                                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                         paginator="true" rows="15" paginatorPosition="bottom"
                                         rowsPerPageTemplate="100,50,30,15,5"
                                         emptyMessage="没有查询到数据记录...">
                                <p:column headerText="卡号" style="text-align: center">
                                    <h:outputText value="#{cdttxnAction.cardNo}"/>
                                </p:column>
                                <p:column headerText="流水号" style="text-align: right">
                                    <h:outputText value="#{record.lognum}"/>
                                </p:column>
                                <p:column headerText="交易金额">
                                    <h:outputText value="#{record.txnamt}" style="float: right">
                                        <f:convertNumber pattern="###,##0.00"/>
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="产品信息" style="text-align: left">
                                    <h:outputText value="#{record.pdctinfo}"/>
                                </p:column>
                                <p:column headerText="客户姓名" style="text-align: left">
                                    <h:outputText value="#{record.cnsumname}"/>
                                </p:column>
                                <p:column headerText="身份证号" style="text-align: left">
                                    <h:outputText value="#{record.idcode}"/>
                                </p:column>
                                <p:column headerText="客户电话" style="text-align: left">
                                    <h:outputText value="#{record.cnsumtel}"/>
                                </p:column>
                                <p:column headerText="交易日期" style="text-align: center">
                                    <h:outputText value="#{record.txndate}"/>
                                </p:column>
                                <p:column headerText="交易类型" style="text-align: center">
                                    <h:outputText value="#{cdttxnAction.txnType.valueOfAlias(record.txntype).title}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </h:form>
                </p:tab>
            </p:tabView>
        </div>
    </ui:define>
</ui:composition>